package TCPTest03UploadFile;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        //1.创建 socket对象
        Socket socket = new Socket("127.0.0.1",10000);
        //2、获取输出流
        OutputStream outputStream = socket.getOutputStream();
        //3、获取文科输入流
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\webP\\client\\1.txt"));
        BufferedOutputStream bos = new BufferedOutputStream(outputStream);
        //4、读取文件，并通过TCP输出
        byte[] bytes = new byte[1024];
        while(bis.read(bytes) != -1){
            bos.write(bytes);
        }
        //5、关闭资源
        socket.close();
        bis.close();
        bos.close();
    }
    
}
